<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工具库</title>
    <script type="text/javascript">
        function check(){
            var text_value = document.getElementById('content_value').value;
            if(text_value == ""){
                alert("不能为空");
                return false;
            } else {
                var res="";
                for(var i=0,j=0,k=0,ii,ele;i<text_value.length;i++)
                {
                    //k:缩进，j:""个数
                    ele=text_value.charAt(i);
                    if(j%2==0&&ele=="}")
                    {
                        k--;
                        for(ii=0;ii<k;ii++) ele="    "+ele;
                        ele="\n"+ele;
                    }
                    else if(j%2==0&&ele=="{")
                    {
                        ele+="\n";
                        k++;
                        debugger;
                        for(ii=0;ii<k;ii++) ele+="    ";
                    }
                    else if(j%2==0&&ele==",")
                    {
                        ele+="\n";
                        for(ii=0;ii<k;ii++) ele+="    ";
                    }
                    else if(ele=="\"") j++;
                    res+=ele;
                }
                document.getElementById('output_value').value = res;
            }
        }
    </script>
</head>
<body>

</body>
</html>